/**
 * Created by Administrator on 2017-11-25
 */
define(function (require, exports, module) {
    'use strict';
    var orderno;
    var userid;
    function comfirm() {
        $.ajax({
            type: "POST",
            url: "/cart/advancewait",
            data: {
                reservearray:reservearray
            },
            dataType: "json",
            success: function (res) {
                orderno=res.data.data.data[0].orderno;
                userid=res.data.data.data[0].userid;
            }
        });
        $("#reservemenu").slideDown();
        $(".backcolor").css("opacity", "0.7");
        $(".backcolor").css("display", "block");
    }

    function paysucess(way) {
        var deposit=$(".earnest").html();
        if(way=="wx"){
            $("#wx").show();
            $("#ali").hide();
            $.ajax({
                type: "GET",
                url: "/cart/payearnest?userid="+user.id+"&sid="+sid +"&orderno="+orderno+"&way="+way+"&deposit="+deposit,
                dataType: "json",
                success: function (res) {
                    $("#reservemenu").hide();
                    $("#paysuss").show();
                    $(".backcolor").css("display", "block");
                }
            });
        }else if(way=="ali"){
            $("#ali").show();
            $("#wx").hide();
            $.ajax({
                type: "GET",
                url: "/cart/payearnest?userid="+user.id+"&sid="+sid +"&orderno="+orderno+"&way="+way+"&deposit="+deposit,
                dataType: "json",
                success: function (res) {
                    $("#reservemenu").hide();
                    $("#paysuss").show();
                    $(".backcolor").css("display", "block");
                }
            });
        }

    }
    return {
        comfirm:comfirm,
        paysucess:paysucess
    }
});